<!DOCTYPE html>
<html>
<head>
    <title></title>
		<#include "/header.html">
</head>
<style>
    #container {
        width:400px;
        height: 300px;
    }
</style>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <div class="grid-btn">
            <div style="float: left;height:34px;line-height:34px;">店铺名称或地址：</div>
            <div style="float: left;">
                <input type="text" class="form-control" v-model="q.name" @keyup.enter="query" placeholder="请输入内容">
            </div>


            <div style="float: left;margin-left:10px;height:34px;line-height:34px;">状态：</div>
            <div style="float: left;width:160px;margin-right: 10px;">
                <select class="form-control" v-model="q.statu" @keyup.enter="query">
                    <option></option>
                    <option value="0">启用</option>
                    <option value="1">禁用</option>
                </select>
            </div>

            <a class="btn btn-primary" @click="query">搜索</a>
            <#if shiro.hasPermission("sys:goodshelves:save")>
            <a class="btn btn-primary" @click="add">&nbsp;新增外卖店铺</a>
        </#if>
        </div>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <div v-show="!showList" class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal">
														                    <div class="form-group">
                        <div class="col-sm-2 control-label">外卖服务</div>
                        <div class="col-sm-10" @click="setTakeOut">
                            <label class="radio-inline">
                                <input type="radio" name="statu" value="0" v-model="takeoutset.statu"/> 启用
                            </label>
                            <label class="radio-inline">
                                <input type="radio" name="statu" value="1" v-model="takeoutset.statu"/> 禁用
                            </label>
                        </div>
                    </div>
                    <div id="wm">
						<div class="form-group">
                            <div class="col-sm-2 control-label"><span style="color: red">*</span>营业时间</div>
                            <div class="col-sm-10" id="yysj">

                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-2 control-label"></div>
                            <div class="col-sm-10">
                                <a style="height: 32px;line-height: 32px;width: 90px;background-color: #59b26c;font-size: 12px;
                                color: #fff;border: none;display: inline-block;text-decoration:none;text-align: center;border-radius: 16px;cursor: pointer;" @click="addBusTime">添加时间段</a>
                            </div>
                        </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>联系电话</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="takeoutset.telphone" placeholder="联系电话"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>门店地址</div>
                        <div class="col-sm-10">
                            <select class="form-control" v-model="takeoutset.province" style="float: left;width: 30%" id="province" @change="getCity">

                            </select>
                            <div style="width: 3%;float:left;margin-left:7px;margin-top:8px;padding-left:1px;">
                                -
                            </div>
                            <select class="form-control" v-model="takeoutset.city" style="float: left;width: 30%" id="city" @change="getArea">

                            </select>
                            <div style="width: 3%;float:left;margin-left:7px;margin-top:8px;padding-left:1px;">
                                -
                            </div>
                            <select class="form-control" v-model="takeoutset.area" style="float: left;width: 30%" id="area" >

                            </select>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>详细地址</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="takeoutset.detailedaddress" placeholder="详细地址" id="detailedaddress"/>
                        </div>
                    </div>
                        <div class="form-group">
                            <div class="col-sm-2 control-label"></div>
                            <div class="col-sm-10" style="width: 400px; height: 300px; border: 1px solid rgb(222, 229, 231);">
                                <div id="container"></div>
                            </div>
                        </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>配送范围</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="takeoutset.ranges" placeholder="配送范围"/>
                            <span style="position: absolute;right: 22px;top: 8px;color: #4C4948;line-height: 1.5;">公里</span>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>起送价格</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="takeoutset.sendprice" placeholder="起送价格"/>
                            <span style="position: absolute;right: 22px;top: 8px;color: #4C4948;line-height: 1.5;">元</span>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>配送费</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="takeoutset.fee" placeholder="配送费"/>
                            <span style="position: absolute;right: 22px;top: 8px;color: #4C4948;line-height: 1.5;">元</span>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label">自动接单</div>
                        <div class="col-sm-10">
                            <label class="radio-inline">
                                <input type="radio" name="type" value="0" v-model="takeoutset.autoreceipt"/> 启用
                            </label>
                            <label class="radio-inline">
                                <input type="radio" name="type" value="1" v-model="takeoutset.autoreceipt"/> 禁用
                            </label>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label">公告栏信息</div>
                        <div class="col-sm-10">
                            <textarea class="form-control" v-model="takeoutset.notice" cols="6" rows="7" placeholder="公告栏信息">

                            </textarea>
                        </div>
                    </div>
                        <div class="form-group">
                            <div class="col-sm-2 control-label">绑定货架</div>
                            <div class="col-sm-10">
                                <select class="form-control" v-model="takeoutset.shelvesid" id="sheelves_id">

                                </select>
                            </div>
                        </div>
                    </div>
							            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
            </div>
        </form>
    </div>
</div>

<script src="${request.contextPath}/statics/js/modules/sys/takeoutset.js?_${.now?long}"></script>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.13&key=6e5355706293cacf71a780a909deb37d&plugin=AMap.Geocoder"></script>
<script>
    $(function() {
        $('.timepicker').timepicker({
            showMeridian:false
        });
    });
    $("#sandbox-container .input-group.date").datepicker({
        language: "zh-CN",
        clearBtn: true, //清除按钮
        format: "yyyy-mm-dd",
        todayHighlight:true
    });
    var map = new AMap.Map('container', {
        zoom:11,//级别
        viewMode:'3D'//使用3D视图
    });
    var geocoder;
    function regeoCode(point) {
        if(!geocoder){
            geocoder = new AMap.Geocoder({
                city: "010", //城市设为北京，默认：“全国”
                radius: 1000 //范围，默认：500
            });
        }
        var lnglat  = point.split(',');

        geocoder.getAddress(lnglat, function(status, result) {
            if (status === 'complete'&&result.regeocode) {
                var address = result.regeocode.formattedAddress;
                $("#detailedaddress").val(address);
            }else{alert(JSON.stringify(result))}
        });
    }

    map.on('click',function(e){
        var point = e.lnglat.lng+","+e.lnglat.lat
        regeoCode(point);
    })
</script>
</body>
</html>